package com.text.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity  // 标注这是一个 JPA 实体类，映射到数据库表
@Table(name = "students")  // 指定数据库表名
public class Student {

    @Id  // 设置 studentId 为主键
    @Column(name = "student_id", nullable = false, unique = true)  // 数据库列名和约束
    private String studentId;

    @Column(name = "student_name", nullable = false)  // 数据库列名和约束
    private String studentName;

    @Column(name = "student_gender", nullable = false, length = 10)  // 数据库列名和约束
    private String studentGender;

    @Column(name = "student_phone", nullable = false, length = 15)  // 数据库列名和约束
    private String studentPhone;

    @Column(name = "major", nullable = false, length = 50)  // 数据库列名和约束
    private String major;
}